<template>
  <u-tabs :list="list" @click="Tabs" :scrollable="false" :activeStyle="activeStyle" lineColor="#0c22b0"
    :inactiveStyle="inactiveStyle" itemStyle=" height: 34px; width:50%;"></u-tabs>
  <scroll-view style="  background: #f6f6f6;     width: 100%; " scroll-y>
    <view class="orderlist" v-if="listItem.list.length > 0">
      <view class="item" v-for="(item, index) in  listItem.list" :key="index"
        @click="NavTo(`/pages/Order/OrderDeatil?&Type=${baseData.distributionType}&orderType=4&id=${item.id}`)">
        <!-- 状态栏 -->
        <!-- 状态栏 -->
        <view class="StatusBar flex_al_cen_ju_bet">
          <view class="Bar flex_al_cen_ju_bet">
            <view class="Timestatus flex text_ovf">
              <!-- <view class="timeout">超时</view> -->
              <view class="status">订单已完成</view>
              <view class="time text_ovf">送达时间 {{ forDate(item.deliveryTime) }}</view>
            </view>
          </view>
          <view class="price red"> ￥<text>{{ item.price }}</text></view>
        </view>
        <!-- 地址 + 内容 -->
        <view class="AddR_Cont">
          <!-- 地址 -->
          <AddressDelatils :Type="baseData.distributionType" :orderType='baseData.distributionType' :TitleShow="TitleShow"
            :item="item">
          </AddressDelatils>
          <!-- 备注 -->
          <view class="remarks text_ovf">
            {{ item.remark }}
          </view>
          <view class="margin_t_b">订单里程: {{ item.distance }}km</view>
          <view>订单编号:{{ item.orderSn }}</view>
        </view>
      </view>
    </view>
  </scroll-view>
  <DefaultPage v-if="listItem.list.length <= 0" :type="'noMsg'" :tips="'暂无订单'"> </DefaultPage>
  <u-toast ref="uToast"></u-toast>
</template>
<script setup lang="ts">
import { forDate } from '@/utlis/time'
import Order from "@/Hooks/Order/Order";
import { NavTo } from "@/utlis/uni_api";
import { onLoad, onReachBottom } from "@dcloudio/uni-app";
import { getCurrentInstance, ref } from "vue";
import DefaultPage from "@/components/DefaultPage.vue";
const { proxy } = getCurrentInstance() as any;
/**
 * Type: 
  orderType:
  item: any,
 */
const TitleShow = ref<boolean>(false)
const { inactiveStyle, activeStyle, Tabs, list, Overllist, listItem, baseData, OverListCount } = Order(proxy);
onLoad(() => {
  OverListCount()
  Overllist()

})
onReachBottom(() => {
  baseData.pageNo++
  if (listItem.list_show) {
    Overllist()
  } else {
    proxy.$API(proxy).Toast('暂无更多数据', 'warning')
  }


})
</script>
<style scoped lang="scss">
@import "../../static/css/Order/Order.scss";
</style>
